home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / librw / RWBTreeDictionary.z / RWBTreeDictionary
Encoding:
Text File  |  1998-10-30  |  17.3 KB  |  397 lines

  1.  
  2.  
  3.  
  4. RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))                                RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))
  5.  
  6.  
  7.  
  8. NNNNaaaammmmeeee
  9.      RWBTreeDictionary - Rogue Wave library class
  10.  
  11. SSSSyyyynnnnooooppppssssiiiissss
  12.               #include <rw/btrdict.h>
  13.  
  14.  
  15.  
  16.  
  17.           RWBTreeDictionary a;
  18.  
  19.  
  20.  
  21.  
  22. DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
  23.      Dictionary class implemented as a B-tree, for the storage and retrieval
  24.      of key-value pairs.  Both the keys and values must inherit abstract base
  25.      class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee -- the elements are ordered internally according to
  26.      the value returned by virtual function ccccoooommmmppppaaaarrrreeeeTTTToooo(((()))) of the key (see class
  27.      RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee).  Duplicate keys are not allowed.  The B-tree is bbbbaaaallllaaaannnncccceeeedddd.
  28.      That is, nodes are never allowed to have less than a certain number of
  29.      items (called the oooorrrrddddeeeerrrr).  The default order is 50, but may be changed by
  30.      resetting the value of the static constant "oooorrrrddddeeeerrrr" in the header file
  31.      <<<<bbbbttttrrrreeeeeeee....hhhh>>>> and recompiling.  Larger values will result in shallower trees,
  32.      but less efficient use of memory.
  33.  
  34. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
  35.      Polymorphic
  36.  
  37. PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
  38.               RWBTreeDictionary();
  39.  
  40.  
  41.      Constructs an empty B-tree dictionary.
  42.  
  43. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr OOOOppppeeeerrrraaaattttoooorrrrssss
  44.               RWBoolean
  45.           ooooppppeeeerrrraaaattttoooorrrr<<<<====(const RWBTreeDictionary& btr) const;
  46.  
  47.  
  48.      Returns TTTTRRRRUUUUEEEE if self is a subset of bbbbttttrrrr.  That is, for every item in
  49.      self, there must be an item in bbbbttttrrrr that compares equal.  This operator is
  50.      not explicitly present unless you are compiling with an implementation of
  51.      the C++ Standard Library.  Normally it is inherited from RRRRWWWWBBBBTTTTrrrreeeeeeee. NNNNooootttteeee:
  52.      If you inherit from RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy in the presence of the C++ Standard
  53.      Library, we recommend that you override this operator and explicitly
  54.      forward the call.  Overload resolution in C++ will choose the Standard
  55.      Library provided global operators over inherited class members.  These
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))                                RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))
  71.  
  72.  
  73.  
  74.      global definitions are not appropriate for set-like partial orderings.
  75.  
  76. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss
  77.               void
  78.           aaaappppppppllllyyyyTTTTooooKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee(RWapplyKeyAndValue ap,void*);
  79.  
  80.  
  81.      Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.  Applies the user-supplied function
  82.      pointed to by aaaapppp to each key-value pair of the collection, in order, from
  83.      smallest to largest.
  84.  
  85.               RWBinaryTree
  86.           aaaassssBBBBiiiinnnnaaaarrrryyyyTTTTrrrreeeeeeee();
  87.           RWBag
  88.           aaaassssBBBBaaaagggg() const;
  89.           RWSet
  90.           aaaassssSSSSeeeetttt() const;
  91.           RWOrdered
  92.           aaaassssOOOOrrrrddddeeeerrrreeeeddddCCCCoooolllllllleeeeccccttttiiiioooonnnn() const;
  93.           RWBinaryTree
  94.           aaaassssSSSSoooorrrrtttteeeeddddCCCCoooolllllllleeeeccccttttiiiioooonnnn() const:
  95.  
  96.  
  97.      Converts the RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy to an RRRRWWWWBBBBaaaagggg, RRRRWWWWSSSSeeeetttt, RRRRWWWWOOOOrrrrddddeeeerrrreeeedddd, or an
  98.      RRRRWWWWBBBBiiiinnnnaaaarrrryyyyTTTTrrrreeeeeeee.  Note that since a dictionary contains pairs of keys and
  99.      values, the result of this call will be a container holding
  100.      RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeeeAAAAssssssssoooocccciiiiaaaattttiiiioooonnnnssss.  Note also that the return value is a ccccooooppppyyyy of
  101.      the data. This can be very expensive for large collections.  Consider
  102.      using ooooppppeeeerrrraaaattttoooorrrr++++====(((()))) to insert each RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeeeAAAAssssssssoooocccciiiiaaaattttiiiioooonnnn from this
  103.      dictionary into a collection of your choice.
  104.  
  105.               virtual RWspace
  106.           bbbbiiiinnnnaaaarrrryyyySSSSttttoooorrrreeeeSSSSiiiizzzzeeee() const;
  107.  
  108.  
  109.      Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.
  110.  
  111.               virtual void
  112.           cccclllleeeeaaaarrrr();
  113.  
  114.  
  115.      Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.  Removes all key-value pairs from the
  116.      collection.
  117.  
  118.               virtual void
  119.           cccclllleeeeaaaarrrrAAAAnnnnddddDDDDeeeessssttttrrrrooooyyyy();
  120.  
  121.  
  122.      Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.  Removes all key-value pairs in the
  123.      collection, and deletes bbbbooootttthhhh the key and the value.
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))                                RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))
  137.  
  138.  
  139.  
  140.               virtual int
  141.           ccccoooommmmppppaaaarrrreeeeTTTToooo(const RWCollectable* a) const;
  142.  
  143.  
  144.      Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee.
  145.  
  146.               virtual RWBoolean
  147.           ccccoooonnnnttttaaaaiiiinnnnssss(const RWCollectable* target) const;
  148.  
  149.  
  150.      Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.
  151.  
  152.               virtual size_t
  153.           eeeennnnttttrrrriiiieeeessss() const;
  154.  
  155.  
  156.      Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.
  157.  
  158.               virtual RWCollectable*
  159.           ffffiiiinnnndddd(const RWCollectable* target) const;
  160.  
  161.  
  162.      Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.  Returns the key in the collection
  163.      which compares equal to the object pointed to by ttttaaaarrrrggggeeeetttt, or nnnniiiillll if no key
  164.      is found.
  165.  
  166.               RWCollectable*
  167.           ffffiiiinnnnddddKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee(const RWCollectable* target,
  168.                           RWCollectable*& v) const;
  169.  
  170.  
  171.      Returns the key in the collection which compares equal to the object
  172.      pointed to by ttttaaaarrrrggggeeeetttt, or nnnniiiillll if no key was found.  The value is put in vvvv.
  173.      You are responsible for defining vvvv before calling this function.
  174.  
  175.               RWCollectable*
  176.           ffffiiiinnnnddddVVVVaaaalllluuuueeee(const RWCollectable* target) const;
  177.  
  178.  
  179.      Returns the vvvvaaaalllluuuueeee associated with the key which compares equal to the
  180.      object pointed to by ttttaaaarrrrggggeeeetttt, or nnnniiiillll if no key was found.
  181.  
  182.               RWCollectable*
  183.           ffffiiiinnnnddddVVVVaaaalllluuuueeee(const RWCollectable* target,
  184.                     RWCollectable* newValue);
  185.  
  186.  
  187.      Returns the vvvvaaaalllluuuueeee associated with the key which compares equal to the
  188.      object pointed to by ttttaaaarrrrggggeeeetttt, or nnnniiiillll if no key was found.  Replaces the
  189.      value with nnnneeeewwwwVVVVaaaalllluuuueeee (if a key was found).
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))                                RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))
  203.  
  204.  
  205.  
  206.               virtual unsigned
  207.           hhhhaaaasssshhhh() const;
  208.  
  209.  
  210.      Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee.
  211.  
  212.               unsigned
  213.           hhhheeeeiiiigggghhhhtttt() const;
  214.  
  215.  
  216.      Inherited from class RRRRWWWWBBBBTTTTrrrreeeeeeee.
  217.  
  218.               RWCollectable*
  219.           iiiinnnnsssseeeerrrrttttKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee(RWCollectable* key,RWCollectable* value);
  220.  
  221.  
  222.      Adds a key-value pair to the collection and returns the key if
  223.      successful, nnnniiiillll if the key is already in the collection.
  224.  
  225.               virtual RWClassID
  226.           iiiissssAAAA() const;
  227.  
  228.  
  229.      Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee to return ________RRRRWWWWBBBBTTTTRRRREEEEEEEEDDDDIIIICCCCTTTTIIIIOOOONNNNAAAARRRRYYYY.
  230.  
  231.               virtual RWBoolean
  232.           iiiissssEEEEmmmmppppttttyyyy() const;
  233.  
  234.  
  235.      Inherited from class RRRRWWWWBBBBTTTTrrrreeeeeeee.
  236.  
  237.               virtual RWBoolean
  238.           iiiissssEEEEqqqquuuuaaaallll(const RWCollectable* a) const;
  239.  
  240.  
  241.      Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee.
  242.  
  243.               virtual size_t
  244.           ooooccccccccuuuurrrrrrrreeeennnncccceeeessssOOOOffff(const RWCollectable* target) const;
  245.  
  246.  
  247.      Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.  Returns the number of keys that
  248.      compare equal with ttttaaaarrrrggggeeeetttt.  Because duplicates are not allowed, this
  249.      function can only return 0 or 1.
  250.  
  251.               virtual RWCollectable*
  252.           rrrreeeemmmmoooovvvveeee(const RWCollectable* target);
  253.  
  254.  
  255.      Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.  Removes the key and value pair for
  256.      which the key compares equal to the object pointed to by ttttaaaarrrrggggeeeetttt.  Returns
  257.      the key, or nnnniiiillll if no match was found.
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))                                RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))
  269.  
  270.  
  271.  
  272.               virtual void
  273.           rrrreeeemmmmoooovvvveeeeAAAAnnnnddddDDDDeeeessssttttrrrrooooyyyy(const RWCollectable* target);
  274.  
  275.  
  276.      Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.  Removes aaaannnndddd deletes the key and value
  277.      pair for which the key compares equal to the object pointed to by ttttaaaarrrrggggeeeetttt.
  278.      Note that both the key and the value are deleted.  Does nothing if the
  279.      key is not found.
  280.  
  281.               RWCollectable*
  282.           rrrreeeemmmmoooovvvveeeeKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee(const RWCollectable* target,
  283.                             RWCollectable*& v);
  284.  
  285.  
  286.      Removes the key and value pair for which the key compares equal to the
  287.      object pointed to by target.  Returns the key, or nnnniiiillll if no match was
  288.      found.  The value is put in vvvv.  You are responsible for defining vvvv before
  289.      calling this function.
  290.  
  291.               virtual void
  292.           rrrreeeessssttttoooorrrreeeeGGGGuuuuttttssss(RWvistream&);
  293.           virtual void
  294.           rrrreeeessssttttoooorrrreeeeGGGGuuuuttttssss(RWFile&);
  295.           virtual void
  296.           ssssaaaavvvveeeeGGGGuuuuttttssss(RWvostream&) const;
  297.           virtual void
  298.           ssssaaaavvvveeeeGGGGuuuuttttssss(RWFile&) const;
  299.  
  300.  
  301.      Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.
  302.  
  303.               virtual RWCollection*
  304.           sssseeeelllleeeecccctttt(RWtestCollectable testfunc, void* x) const;
  305.  
  306.  
  307.      Evaluates the function pointed to by ttttsssstttt for the key of each item in the
  308.      RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy.  It inserts keys and values for which the function
  309.      returns TTTTRRRRUUUUEEEE into a new RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy allocated off the heap and
  310.      returns a pointer to this new collection.  Because the new dictionary is
  311.      allocated ooooffffffff tttthhhheeee hhhheeeeaaaapppp, you are responsible for deleting it when done.
  312.      This is not a virtual function.
  313.  
  314.               virtual RWCollection*
  315.           sssseeeelllleeeecccctttt(RWtestCollectablePair testfunc, void* x) const;
  316.  
  317.  
  318.      Evaluates the function pointed to by ttttsssstttt for both the key and the value
  319.      of each item in the RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy.  It inserts keys and values for
  320.      which the function returns TTTTRRRRUUUUEEEE into a new RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy allocated
  321.      off the heap and returns a pointer to this new collection.  Because the
  322.      new dictionary is allocated ooooffffffff tttthhhheeee hhhheeeeaaaapppp, you are responsible for
  323.      deleting it when done.  This is not a virtual function.
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))                                RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))
  335.  
  336.  
  337.  
  338.               RWStringID
  339.           ssssttttrrrriiiinnnnggggIIIIDDDD();
  340.  
  341.  
  342.      (acts virtual) Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee.
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.